package eu.tanov.epf.pv.types.projectiteration.ui.pages;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;

public class ComboEditingSupport extends EditingSupport {

	protected TableViewer viewer;

	public ComboEditingSupport(TableViewer viewer) {
		super(viewer);
		this.viewer = viewer;
	}

	@Override
	protected CellEditor getCellEditor(Object element) {
		System.out.println("getCellEditor");
		return new ComboBoxCellEditor(viewer.getTable(), new String[] { "Low",
				"High" });
	}

	@Override
	protected boolean canEdit(Object element) {
		System.out.println("canEdit");

		return true;
	}

	@Override
	protected Object getValue(Object element) {
		System.out.println("getvalue");
		return 0;
	}

	@Override
	protected void setValue(Object element, Object value) {
		System.out.println(value);
		viewer.refresh();
	}

}
